package com.yugao.fintech.antelope.infra.weixin.mp.assembly;

import com.yugao.fintech.antelope.infra.weixin.mp.model.entity.MpMenu;
import com.yugao.fintech.antelope.infra.weixin.mp.model.rqrs.MpMenuReq;
import com.yugao.fintech.antelope.infra.weixin.mp.model.rqrs.MpMessageSendOutReq;
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 公众号菜单
 *

 */
@Mapper(componentModel = "spring")
public interface MpMenuAssembly {
    MpMenu toMpMenu(MpMenuReq.Menu source);

    @Mappings({
            @Mapping(source = "type", target = "type"),
            @Mapping(source = "menuKey", target = "key"),
            @Mapping(source = "mpAppId", target = "appId"),
    })
    WxMenuButton toWxMenu(MpMenu source);

    @Mappings({
            @Mapping(source = "openId", target = "openId"),
            @Mapping(source = "menu.mpAppId", target = "appId"),
            @Mapping(source = "menu.replyMessageType", target = "type"),
            @Mapping(source = "menu.replyContent", target = "content"),
            @Mapping(source = "menu.replyMediaId", target = "mediaId"),
            @Mapping(source = "menu.replyThumbMediaId", target = "thumbMediaId"),
            @Mapping(source = "menu.replyTitle", target = "title"),
            @Mapping(source = "menu.replyDescription", target = "description"),
            @Mapping(source = "menu.replyArticles", target = "articles"),
            @Mapping(source = "menu.replyMusicUrl", target = "musicUrl"),
            @Mapping(source = "menu.replyHqMusicUrl", target = "hqMusicUrl"),
    })
    MpMessageSendOutReq toMpMessageSendOutRS(String openId, MpMenu menu);
}